/*
 * @Description: 
 * @Author: ljy
 * @Date: 2021-12-02 17:00:53
 * @LastEditors: ljy
 * @LastEditTime: 2021-12-02 17:43:24
 */
var express = require('express');
var router = express.Router();
const { findAll, deleteById, add } = require("../db/t_comment")

/* GET users listing. */
router.get('/', function(req, res, next) {
    // console.log(req.body);
    findAll((result) => {
        res.send(result)
    })
});

router.get('/deleteById', function(req, res, next) {
    // console.log(req.body);
    deleteById(req.query.id, (result) => {
        console.log(result.affectedRows);
    })
});

router.post('/add', function(req, res, next) {
    console.log(req.body);
    add(req.body, (result) => {
        console.log(result);
    })
});

module.exports = router;